
#include <avr/io.h>

#define PWM_CHANNELA_OUTPUT_BIT 4
#define PWM_CHANNELA_OUTPUT_DDR DDRD

#define PWM_CHANNELB_OUTPUT_BIT 5
#define PWM_CHANNELB_OUTPUT_DDR DDRD


void PWM_SetDutyOnChanelA(unsigned char duty)
{
		OCR1A=duty;
}

void PWM_SetDutyOnChanelB(unsigned char duty)
{
		OCR1B=duty;
}




void PWM_Init(void)
{

PWM_CHANNELA_OUTPUT_DDR   |=  (1 << PWM_CHANNELA_OUTPUT_BIT); // set as output
PWM_CHANNELB_OUTPUT_DDR   |=  (1 << PWM_CHANNELB_OUTPUT_BIT); // set as output

PWM_SetDutyOnChanelA(0);
PWM_SetDutyOnChanelB(0);

//Output compare OC1A,OC1B 8 bit (max 0x3FF) non inverted PWM
//TCCR1A=0b10100001;


//Output compare OC1A,OC1B 8 bit (max 0x3FF) channel A non inverted PWM, channel B inverted
TCCR1A=0b10110001;




//start timer without prescaler (PWM work at 31.25kHz)
TCCR1B=0b00001001;

}

